Skip to content

Instantly share code, notes, and snippets.

@degitgitagitya
degitgitagitya / .env
Last active May 10, 2024 00:12
Next JS + Next Auth + Keycloak + AutoRefreshToken
# KEYCLOAK BASE URL
KEYCLOAK_BASE_URL=
# KEYCLOAK CLIENT SECRET
KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK CLIENT ID
KEYCLOAK_CLIENT_ID=
# BASE URL FOR NEXT AUTH
## Will successfully install amdgpu drivers and rocm,
## but pointless as there is no gpu device attached to WSL2 (only CUDA and DirectML is supported, not /dev/kfd or amd gpus)
## ROCM/HIP
sudo apt update
sudo apt dist-upgrade
sudo apt install libnuma-dev
wget -q -O - http://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
echo 'deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main' | sudo tee /etc/apt/sources.list.d/rocm.list
@Faria-Ejaz
Faria-Ejaz / Map.js
Last active May 10, 2024 00:09
react Leaflet Map with Auto-suggest Search #leaflet #react-leaflet #search
/** @format */
import { Map, TileLayer, Marker, Popup } from "react-leaflet";
import React, { useEffect, useState, useRef } from "react";
import { geosearch } from "esri-leaflet-geocoder";
import "leaflet/dist/leaflet.css";
import "esri-leaflet-geocoder/dist/esri-leaflet-geocoder.css";
import L from "leaflet";
function MapView(props) {
// Convert the format string from moment's "L" to a format usable by
// [bootstrap-datepicker][1].
//
// Call it with:
//
// momentFormatToDatePicker(moment.localeData().longDateFormat("L")).
//
// [1]: https://bootstrap-datepicker.readthedocs.org/en/latest/options.html#format
function momentFormatToDatePicker(format) {
// The actual translation is more detailed:
// script tags are HTML, don't put them in JavaScript Files.
// <script type="text/javascript" src="js/jquery.min.js"></script>
// <script type="text/javascript">
// Indent your code! It organizes levels and lets you know what statements are in what scope.
// Organization is key in programming, Don't make it harder for yourself.
$(document).ready(function() {
$(document).on('click', '.day', function() {
$('.times-' + this.value).toggle();
});
@sukima
sukima / BetterCommitMessages.md
Last active May 10, 2024 00:08
My guidelines for writing better commit messages
#!/usr/bin/env node
var debug = require('debug')('doc-fetcher');
var Promise = require('bluebird');
var path = require('path');
var htmlparser = require('htmlparser');
var select = require('soupselect').select;
var request = Promise.promisifyAll(require('request'));
var fs = Promise.promisifyAll(require('fs'));
var cookieJar = request.jar();
@sukima
sukima / .vimrc
Created December 20, 2014 17:40
Auto close parenthisis in VIM
" Section: AutoClose {{{2
" Auto close parenthesis
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
function getPromise() {
return new Promise(function(resolve, reject) {
// Do something asynchronous
setTimeout(function() { resolve('Async Value'); }, 500);
})
.then(function(value) {
return 'New Async Value';
});
}
// The frame work I need to use defines the following API:
//
// MyObject = {
// addEventListener: function(name, listenerCallback) {...},
// removeEventListener: function(name, listenerCallback) {...},
// };
//
// MyObject
// is an object and the events are stored pervasivly (this is not an instance
// that can be Garbage Collected).